<?php 
$v_record_id = 0;
if(isset($_REQUEST['hdn_record_id'])){
	$v_record_id = _replace_bad_char($_REQUEST['hdn_record_id']);
}
$v_date = "";
if(isset($_REQUEST['txt_date'])){
	$v_date = _ddmmyyyy_to_yyyymmdd($_REQUEST['txt_date']);
}
$v_receiver = "";
if(isset($_REQUEST['txt_name'])){
	$v_receiver = _replace_bad_char($_REQUEST['txt_name']);
}
if(isset($_REQUEST['txt_cost'])){
	$p_cost = str_replace(_CONST_DECIMAL_DELIMITOR,"",$_REQUEST['txt_cost']);
}
if(is_null($p_cost) || trim($p_cost)==""){
	$p_cost = 0;
}
$v_date_result = date("d/m/Y");
$v_staff_id = $_SESSION['staff_id'];
if(_is_sqlserver()){
	$sql = "Exec Onegate_RecordLicenceUpdate " ;
	$sql = $sql . $v_record_id;
	$sql = $sql . ",'".$v_date."'";
	$sql = $sql . ",'".$v_receiver."'";
	$sql = $sql . ",'".$p_cost."'";		//nieuvv--051108--chuyen thanh chuoi
	$sql = $sql . ",".$v_staff_id;
	$sql = $sql . ",'" . _ddmmyyyy_to_yyyymmdd($v_date_result) . "'" ;	
	$sql = $sql . "," . $_ISA_AUTOMATIC_UPDATE_WORK_LIST;
	//echo $sql ; exit;
	$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
	$rs = $ado_conn->GetRow($sql); 
	$v_error = _replace_bad_char(trim($rs['RET_ERROR']));
}
sleep(0);
if (!is_null($v_error) && $v_error<>""){?>
	<script>
		alert("<?php echo $v_error; ?>");
		if (_MODAL_DIALOG_MODE==1){
			window.location = "<?php echo $v_goto_url; ?>";
		}else{
			window.history.back();
		}	
	</script><?php
	exit;
}
?>
<form action="index.php" method="post" name="f_back">
	<input type="hidden" name="fuseaction" value="DISPLAY_ALL_LICENCE_RECORD">
</form>
<Script language="javascript">
	document.forms(0).submit();
</Script>
